#include<iostream>
using namespace std;
const int N = 1010;
int n, m, x1, y1, x2, y2;
int a[N][N];
int main(){
    cin >> n >> m;
    while(m--){
        cin >> x1 >> y1 >> x2 >> y2;
        //每一行进行差分
        for (int i = y1; i <= y2;i++){
            a[x1][i] += 1;
            a[x2 + 1][i] -= 1;
        }
    }
    for (int x = 1; x <= n;x++){
        for (int y = 1; y <= n;y++){
            //求每一行的前缀和
            a[x][y] += a[x - 1][y];
            cout << a[x][y] << " ";
        }
        cout << endl;
    }

    return 0;
}
